package top.jiangqiang.qyblog.core.domain.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import top.jiangqiang.qyblog.core.base.entity.BaseEntity;
import top.jiangqiang.qyblog.core.constant.StorageTypeEnum;
import top.jiangqiang.qyblog.core.domain.StorageProperties;
import top.jiangqiang.qyblog.core.handler.JacksonTypeHandler;

import java.io.Serial;

/**
 * <p>
 * 存储器
 * </p>
 *
 * @author JiangQiang
 * @since 2023-06-28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "qy_storage", autoResultMap = true)
@Schema(name = "Storage", description = "$!{table.comment}")
public class Storage extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "存储器配置名")
    private String name;
    @Schema(description = "存储器类型，例如local，s3")
    private StorageTypeEnum type;

    @Schema(description = "存储器配置")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private StorageProperties config;

    @Schema(description = "是否作为默认存储器使用")
    private Boolean active;
}
